/*
 ============================================================================
 Name		: FbTabitem.h
 Author	  : ceze
 Version	 :
 Copyright   : Your copyright notice
 Description : CFbTabitem Tab项
 ============================================================================
 */

#ifndef FBTABITEM_H
#define FBTABITEM_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <coecntrl.h>
#include <coedef.h>
#include <w32std.H>
// CLASS DECLARATION

/**
 *  CFbTabitem
 * 
 */
class CFbTabitem : public CCoeControl
{
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CFbTabitem( );

	/**
	 * Two-phased constructor.
	 * aItemId:tab id
	 * aResFileName:资源路径
	 * aResImageId:图标资源id
	 * aResImageMaskId:mask图标资源id
	 * aResTextId:文字资源id
	 */
	static CFbTabitem* NewL(const CCoeControl *pParent,TInt aItemId, 
			const TDesC& aResFileName, const TInt& aResImageId, 
			const TInt& aResImageMaskId, 
			const TInt& aResBackId,
			const TRect &aRect, const TInt & aResTextId = 0);

	/**
	 * Two-phased constructor.
	 */
	static CFbTabitem* NewLC(const CCoeControl *pParent,TInt aItemId, 
			const TDesC& aResFileName, const TInt& aResImageId, 
			const TInt& aResImageMaskId,
			const TInt& aResBackId,
			const TRect &aRect,  const TInt & aResTextId = 0);
	
private:
	/**
	 * Constructor for performing 1st stage construction
	 */
	CFbTabitem();
	
	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL(const CCoeControl *pParent,TInt aItemId, 
			const TDesC& aResFileName, const TInt& aResImageId,const TInt& aResImageMaskId, 
			const TInt& aResBackId,
			const TRect &aRect, const TInt & aResTextId);

public:
	/**
	 * Tab id
	 */
	TInt TabId();
	
	/**
	 * tab title
	 */
	HBufC* TabTitle();
	
	/**
	 * 
	 */
	void SetItemActiveL(TBool aActive);
		
	/**
	 * From CCoeControl, Draw
	 * Draw this CFbTabitem to the screen.
	 * @param aRect the rectangle of this view that needs updating
	 */
	void Draw( const TRect& aRect ) const;

	/**
	 * From CoeControl, SizeChanged.
	 * Called by framework when the view size is changed.
	 */
	virtual void SizeChanged();
	/**
	 * From CoeControl,
	 */
	TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent,TEventCode aType);
	
	 /**
	  * From CoeControl,CountComponentControls.
	  */
	  TInt CountComponentControls() const;
	  
	 /**
	  * From CCoeControl,ComponentControl.
	  */
	  CCoeControl* ComponentControl(TInt aIndex) const;
	  
	  /**
	   * 背景颜色
	   */
	  void SetBackColor(const TRgb &aRgb);
	  
	  /**
	   * 设置图标
	   */
	  void SetTabImage(const TDesC& aResFileName, const TInt& aResImageId);
	  
public:
	TInt		m_itemId;//唯一标识
private:
	CFbsBitmap *m_pImage;//图标
	CFbsBitmap *m_pImageMask;//图标mask
	CFbsBitmap	*m_pBack;//底图
	TInt 		m_backResId;//d底图资源id
	HBufC		*m_pTitle;//标题名称
	TBool		m_isFocused;//
	TRgb		m_backColor;
};

#endif // FBTABITEM_H

